//
//  HMPushOnViewController.m
//  HMDemo
//
//  Created by mengxiangyu on 2017/7/12.
//  Copyright © 2017年 mengxiangyu. All rights reserved.
//

#import "HMPushOnViewController.h"
#import "HMPushOn.h"
#import "HMCarousel.h"
#import "HMCalendar.h"

@interface HMPushOnViewController ()<HMCarouselDelegate>
@property (strong, nonatomic) HMPushOn *pushOnView;
@property (strong, nonatomic) NSArray *dataArray;
@property (strong, nonatomic) HMCarousel *carousel;
@end

@implementation HMPushOnViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)];
    view.backgroundColor = [UIColor clearColor];
    [self.view addSubview:view];
//    CGFloat scale1 = HM_WIDTH/750;
//    CGFloat navImageHeight1 = 166*scale1;
    CGFloat dayLabelW = (HM_WIDTH-2*8)/7;
    CGFloat dayLabelH = dayLabelW*0.9;
    
    _dataArray = @[@"0"];
    
    HMCarousel *carousel = [[HMCarousel alloc] initWithFrame:CGRectMake(0, 0, HM_WIDTH, HM_WIDTH*6/7*0.9)];
    [carousel showCarouselRect:CGRectMake(0, 0, HM_WIDTH,  HM_WIDTH*6/7*0.9) carouselCount:_dataArray.count target:self repeat:YES];
    self.carousel = carousel;
    
    _pushOnView = [[HMPushOn alloc] initWithFrame:CGRectMake(0, 64, HM_WIDTH, HM_HEIGHT-64)];
    [self.view addSubview:_pushOnView];
    [_pushOnView showHeadview:carousel holdViewRect:CGRectMake(0, (dayLabelH+2)*2, HM_WIDTH, dayLabelH+2) target:self];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - 轮播控件代理方法
- (void)setContentView:(HMScrollViewItem *)view index:(NSInteger)index {
    HMCalendar *calendar = [[HMCalendar alloc] initWithFrame:CGRectMake(0, 0, HM_WIDTH, HM_WIDTH*6/7)];
    [calendar showCalendarWithYear:2017 month:7];
    //    self.calendar = calendar;
    view.contentView = calendar;
    [calendar.collectionView reloadData];
}

@end
